package com.lagou.springboot;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;

import javax.servlet.ServletException;

public class SpringApplication {

    public static void run(int port){
        try {
            Tomcat tomcat = new Tomcat();
            tomcat.setPort(port);
            tomcat.addWebapp("/", "d:\\");
            tomcat.start();
            tomcat.getServer().await();
        } catch (LifecycleException e) {
            e.printStackTrace();
        } catch (ServletException e) {
            e.printStackTrace();
        }
    }

}
